<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*,swimv2gm.bl.domain.Ability"%>
<!DOCTYPE html>
<html>
<head>
<title>SWIMv2: Elenco competenze</title>
<link rel="stylesheet" type="text/css"
	href="/SWIMv2gm/shared/global.css" />
</head>
<body>
	<div id="header">
		<h1>SWIMv2</h1>
	</div>
	<%@include file="/shared/menu.jsp"%>
	<div id="content">
		<h1>Competenze</h1>
		<%
			boolean isAdmin = request.getSession().getAttribute("admin") != null ? (Boolean)request.getSession()
					.getAttribute("admin") : false;
			boolean isConnected = request.getSession().getAttribute("user") != null;

			if (request.getParameter("executed") != null && "edit".equalsIgnoreCase(request.getParameter("executed"))) {
		%><div class="okbox">Competenza modificata.</div>
		<%
			}

			List<Ability> abilities = ((List<Ability>)request.getAttribute("list"));

			if (abilities == null || abilities.size() == 0) {
		%><p class="message">Nessuna competenza presente</p>
		<%
			}
			else {
		%><dl>
			<%
				for (Ability a:abilities) {
			%>
			<dt><%=a.getNome()%></dt>
			<dd><%=a.getDescrizione()%>
				<ul>
					<li><a
						href="/SWIMv2gm/abilities/UsersWithAbility?cid=<%=a.getId()%>">Tutti
							gli utenti con questa competenza</a></li>
					<%
						if (isAdmin) {
					%><li><a href="/SWIMv2gm/admin/EditAbility?cid=<%=a.getId()%>">Modifica
							competenza</a></li>
					<%
						}
								else if (isConnected) {
					%>
					<li><a
						href="/SWIMv2gm/abilities/UsersWithAbility?cid=
						<%=a.getId()%>&friends=true">Tutti
							gli amici con questa competenza</a></li>
					<%
						}
					%>
				</ul>
			</dd>
			<%
				}
			%>
		</dl>
		<%
			}
		%>
	</div>
</body>
</html>